home *** CD-ROM | disk | FTP | other *** search
- Path: news1.h1.usa.pipeline.com!usenet
- From: grantp@usa.pipeline.com
- Newsgroups: comp.lang.c++
- Subject: Re: while (fgets(element,30,fileptr) != "*")
- Date: 26 Jan 1996 22:48:42 GMT
- Organization: Kalevi, Inc.
- Message-ID: <4ebloa$k6d@news1.usa.pipeline.com>
- NNTP-Posting-Host: pipe12.h1.usa.pipeline.com
- X-PipeUser: grantp
- X-PipeHub: usa.pipeline.com
- X-PipeGCOS: (Pete)
- X-Newsreader: Pipeline USA v3.3.0
-
- On Jan 26, 1996 15:52:30 in article <while (fgets(element,30,fileptr) !=
- "*")>, 'wharris@mail.utexas.edu (W. Harris)' wrote:
-
-
- >Could someone tell me why this doesn't work? I've tried "*/0",
- >"*//0","*/0/r", etc.
-
- Because you're comparing pointers to strings rather than
- the strings themselves.
-
- try:
-
- If your intent is to test only whether or not the first character
- is an asterisk, ignoring the rest:
- while(fgets(element, 30, fileptr) && (element[0] != '*'))
-
- if you want to test for a string of exactly "*", use
- while(fgets(element, 30, fileptr) && strcmp(element, "*"))
-
- --
- Pete Grant
- Kalevi, Inc.
- Object Oriented Software Development
-